namespace _2._23._2015_GroceryList.Data.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class addGroceryItemType : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.GroceryItemTypes",
                c => new
                    {
                        GroceryItemTypeId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                    })
                .PrimaryKey(t => t.GroceryItemTypeId);
            
            AddColumn("dbo.GroceryItems", "GroceryItemTypeId", c => c.Int());
            CreateIndex("dbo.GroceryItems", "GroceryItemTypeId");
            AddForeignKey("dbo.GroceryItems", "GroceryItemTypeId", "dbo.GroceryItemTypes", "GroceryItemTypeId");
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.GroceryItems", "GroceryItemTypeId", "dbo.GroceryItemTypes");
            DropIndex("dbo.GroceryItems", new[] { "GroceryItemTypeId" });
            DropColumn("dbo.GroceryItems", "GroceryItemTypeId");
            DropTable("dbo.GroceryItemTypes");
        }
    }
}
